#ifndef __EC_IT8733_RW__ 
#define __EC_IT8733_RW__ 

class CEcIt8733Rw
{
public:
	static CEcIt8733Rw* getInstance();

private:
	CEcIt8733Rw();

	virtual ~CEcIt8733Rw();

public:
	int get_chip_id(unsigned char *chipid0, unsigned char *chipid1);
	ssize_t ec_it8733_read_cpu_temp(unsigned char *u8FanPwm, int *nCpuTemp, int *nMainBoardTemp, int *nChassisTemp, int *nCpuFan );
	ssize_t ec_it8733_start_read_cpu_temp(unsigned char *u8FanPwm, int *nCpuTemp, int *nMainBoardTemp, int *nChassisTemp, int *nCpuFan );

	ssize_t ec_it8733_get_fan_pwm(unsigned char *u8FanPwm );
	ssize_t ec_it8733_set_fan_pwm(unsigned char u8FanPwm );

	int get_baseaddr_parallel_port( unsigned short *u16FBaseAddrPara );
	int get_baseaddr_env_control( unsigned short *u16FBaseAddrPara );

	ssize_t get_para_port_reg(unsigned char u8AddrOff, unsigned char* u8Data);
	ssize_t set_para_port_reg(unsigned char u8AddrOff, unsigned char u8Data);

private:
	unsigned char ec_inb( unsigned short int port);
	void ec_outb( unsigned char value, unsigned short int port);

	void EnterConfigMode ();
	void ExitConfigMode ();

	ssize_t ec_it8733_dev_config( unsigned char *chipid0, unsigned char *chipid1);

	ssize_t ec_it8733_pnp_read_baseaddr(unsigned char u8LDN, unsigned short *u16BaseAddrPara);
	int get_baseaddr_from_pnp(  unsigned char u8Ldn, unsigned short *u16FBaseAddrPara );

	//void entry_test_status(unsigned char u8Ldn);

	//void dev_test( unsigned char value, unsigned short int port);

private:

	int m_fd;

	unsigned short m_u16BaseAddrLdnParallelPort;
	unsigned short m_u16BaseAddrLdn04;

	unsigned char m_u8PwmDefaultValue;

	static CEcIt8733Rw* m_pInstance;
	
};

#endif

